<?php
	####################################################
	# NTool 잡다한 툴                                  #
	####################################################

	class NTool {
		# 모든 엘레멘트에 보더를 준다.
		public static function allbdr() {
			echo "<style>*{border:1px solid red;}</style>";
		}

		# 타깃 엘레멘트에 보더를 준다.
		public static function bdr() {
			echo("style=\"border:1px solid red !important;\"");
		}

		# 버튼을 리턴한다.
		public static function btn($button_message, $script) {
			return sprintf("<button onclick=\"%s return false;\">%s</button>", $script, $button_message);
		}

		# 서브밋 버튼을 리턴한다.
		#when image button usage :
		#
		#input.submit{
		#  text-indent:-100em;
		#  line-height:100em;
		#  width:100px;
		#  height:50px;
		#  border:0px;
		#  background:url('.../...gif") no-repeat;
		#  overflow:hidden;
		#}
		#
		# <button type="submit" style="width:100px;height:50px;border:0px">
		#    <img src="http://phpschool.com/images/top_logo.gif">
		# </button>
		public static function submit_btn($name = " ") {
			if($name == " "){
				$names = "확인";
			} else {
				$names = $name;
			}
			return sprintf("<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"%s\" />", $names);
		}

		# nbsp를 얻는다.
		public static function nbs($no = 1) {
			return str_repeat("&nbsp;", $num);
		}

		# br 태그를 얻는다.
		public static function br($num = 1) {
			return str_repeat("<br />", $num);
		}

		# 인클루드된 파일을 보여준다.
		public static function inc(){
			Nlog::xmp( print_r(get_included_files(), true) );
		}

		# iframe을 얻는다.
		public static function niframe($src) {
			$iframe = "";
			$iframe .=" <script type=\"text/javascript\">
						function autoResize(i) {
							var iframeHeight=
							(i).contentWindow.document.body.scrollHeight;
							(i).height=iframeHeight+20;
						}
						</script>";
			$iframe .= sprintf("<iframe src=\"%s\" scrolling=\"yes\" onload=\"autoResize(this)\" frameborder=\"1\" marginwidth=\"0\" marginheight=\"0\" width=\"100%%\" height=\"100%%\" style=\"overflow-x:scroll;overflow-y:scroll;display:block;float:left;border:1px solid silver;margin:0;padding:5px;\"></iframe>", $src);

			return $iframe;
		}
	}
?>